package com.xxl.job.admin.controller;

import com.xxl.job.admin.core.conf.XxlJobAdminConfig;
import com.xxl.job.admin.core.model.XxlJobAdminMachine;
import com.xxl.job.admin.dao.XxlJobAdminMachineDao;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author chenlinqing
 * @description:
 * @date: 2025/8/13 9:11
 */
@Controller
@RequestMapping("/machine")
public class XxlJobAdminMachineController {

    @Resource
    private XxlJobAdminMachineDao xxlJobAdminMachineDao;

    @RequestMapping
    public String index(Model model) {
        List<XxlJobAdminMachine> groupList = xxlJobAdminMachineDao.getSurvivalMachineList(XxlJobAdminConfig.getAdminConfig().getMachineDeathTime());
        model.addAttribute("machineList", groupList);
        return "machine/machine.index";
    }
}
